<include file="public@header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:url('contract/index')}">合同列表</a></li>
			<li><a href="{:url('contract/add')}">添加合同</a></li>
		</ul>
        <form class="well form-inline margin-top-20" method="get" action="{:url('contract/index')}">
            客户名称|联系方式:
            <input type="text" class="form-control" name="customer" style="width: 150px;" value="{:input('request.customer/s','')}">
            负责人名称|联系方式:
            <input type="text" class="form-control" name="charge" style="width: 150px;" value="{:input('request.charge/s','')}">
            合同编号:
            <input type="text" class="form-control" name="contract_no" style="width: 150px;" value="{:input('request.contract_no/s','')}">
            签订日期:
            <input type="text" class="form-control js-bootstrap-date" name="sign_date" style="width: 150px;" value="{:input('request.sign_date/s','')}">
            状态:
            <select name="status" class="form-control">
            	<option value=""></option>
            	<option value="1" <if input('status') == 1>selected</if> >已签订</option>
            	<option value="2" <if input('status') == 2>selected</if> >执行中</option>
            	<option value="3" <if input('status') == 3>selected</if> >已完结</option>
            	<option value="4" <if input('status') == 4>selected</if> >已作废</option>
            </select>
            <input type="submit" class="btn btn-primary" value="搜索" />
            <a class="btn btn-danger" href="{:url('contract/index')}">清空</a>
        </form>
        <br>
		<table class="table table-hover table-bordered">
			<thead>
				<tr>
					<th width="50">ID</th>
					<th>客户名称</th>
					<th>负责人</th>
					<th>合同编号</th>
					<th>合同金额</th>
					<th>电梯数量</th>
					<th>签订日期</th>
					<th>执行日期</th>
					<th>结束日期</th>
					<th>状态</th>
					<th width="140">{:lang('ACTIONS')}</th>
				</tr>
			</thead>
			<tbody>
				<foreach name="list" item="vo">
					<tr>
						<td>{$vo.id}</td>
						<td>{$vo.customer.name}|{$vo.customer.mobile}</td>
						<td>{$vo.charge.name}|{$vo.charge.mobile}</td>
						<td>{$vo.contract_no}</td>
						<td>{$vo.amount}</td>
						<td>{$vo.num}</td>
						<td>{$vo.sign_date}</td>
						<td>{$vo.start_date}</td>
						<td>{$vo.end_date}</td>
						<td>{$vo.status_text}</td>
						<td>
							<a class="btn btn-xs btn-primary" href='{:url("contract/edit",array("id"=>$vo["id"]))}'>{:lang('EDIT')}</a>
							<if $vo.status == 1>
	                        	<a class="btn btn-xs btn-success js-ajax-dialog-btn" href='{:url("contract/going",array("id"=>$vo["id"]))}'>执行</a>
	                        </if>
	                        <if $vo.status == 2>
	                        	<a class="btn btn-xs btn-success js-ajax-dialog-btn" href='{:url("contract/finish",array("id"=>$vo["id"]))}'>完结</a>
	                        </if>
							<if $vo.status != 4>
	                        	<a class="btn btn-xs btn-danger js-ajax-dialog-btn" href='{:url("contract/delete",array("id"=>$vo["id"]))}'>作废</a>
	                        </if>
						</td>
					</tr>
				</foreach>
			</tbody>
		</table>
		<div class="pagination">{$page}</div>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
</body>
</html>